package cn.wolfcode.luowowo.test;

import lombok.Getter;
import lombok.Setter;

/**
 * 枚举类特点:
 * 1.构造器私有
 * 2.枚举的实例是固定的 一旦实例固定好 实例个数就固定
 * 3.剩下操作跟普通类一样
 */
public enum MyDate {
    DAY1("day1", 1L), DAY2("day2", 2L), DAY3("day3", 3L);

    @Setter
    @Getter
    private String prefix;
    @Setter
    @Getter
    private Long time;

    private MyDate(String prefix, Long time) {
        this.prefix = prefix;
        this.time = time;
    }

    public static void main(String[] args) {
        System.out.println(MyDate.DAY1);
        System.out.println(MyDate.DAY1.getPrefix());
        System.out.println(MyDate.DAY1.getTime());
    }
}

class MyDate2 {
    public static final MyDate2 day1 = new MyDate2("day1", 1L);
    public static final MyDate2 day2 = new MyDate2("day2", 2L);
    public static final MyDate2 day3 = new MyDate2("day3", 3L);

    @Setter
    @Getter
    private String prefix;
    @Setter
    @Getter
    private Long time;

    private MyDate2(String prefix, Long time) {
        this.prefix = prefix;
        this.time = time;
    }

}
